package cn.tedu.sk.repository.assemblylist.webapi.service;


import cn.tedu.cgb2202.sk.common.repository.ex.ServiceException;
import cn.tedu.cgb2202.sk.common.repository.web.State;
import cn.tedu.cgb2202.sk.pojo.repository.dto.RepositoryAssemblylistAddNewDTO;
import cn.tedu.sk.repository.assemblylist.webapi.mapper.RepositoryMapper;
import cn.tedu.sk.repository.service.IRepositoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 仓库管理业务逻辑层接口实现类
 */
@Service
public class RepositoryServiceImpl implements IRepositoryService {

    @Autowired
    RepositoryMapper repositoryMapper;

    @Override
    public void addNew(RepositoryAssemblylistAddNewDTO repositoryAddNewDTO) {

        // 从参数中取出尝试添加的类别的名称
        String name = repositoryAddNewDTO.getName();
        // 判断查询结果是否不为null
        if(name != null){
            // 是：抛出ServiceException
            throw new ServiceException(State.ERR_CATEGORY_NAME_DUPLICATE,"添加类别失败,仓库名不存在!");
        }
    }
}
